package br.com.caelum.vraptor.controller;

import java.util.List;

import javax.inject.Inject;

import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.dao.GenericDAO;
import br.com.caelum.vraptor.entidades.Administrador;
@Controller
public class AdministradorController {
	
	@Inject
    private Result result;
    
    @Inject
    private GenericDAO<Administrador> dao;

    
    public void add(){
            
    }
    
    public List<Administrador> list(){
            return dao.find();
    }

    public void save(Administrador administrador){
            dao.save(administrador);
            result.redirectTo(this).list();
    }

    public Administrador edit(int id){
        return dao.find(id);
    }

    public void delete(int id){
    	Administrador administrador= new Administrador();
        administrador.setId(id);
        dao.delete(administrador);
        result.redirectTo(this).list();
    }
    
   

}
